package cn.wolfcode.ssm.service.impl;

import cn.wolfcode.ssm.mapper.CustomerReportMapper;
import cn.wolfcode.ssm.qo.QueryObject;
import cn.wolfcode.ssm.service.ICustomerReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CustomerReportServiceImpl implements ICustomerReportService {

    @Autowired
    private CustomerReportMapper customerReportMapper;

    //这个用了pageHelper插件,所以执行sql语句会加上limit子句进行分页
    public PageInfo selectCustomerReport(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Map> list = customerReportMapper.selectCustomerReport(qo);
        return new PageInfo(list);
    }

    //查询出所有的数据(不进行分页)
    @Override
    public List<Map> listAll(QueryObject qo) {
        return customerReportMapper.selectCustomerReport(qo);
    }
}
